﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum FirearmsType {
    pistol,
    rifle,
    rocket,
    flamethrower,
    lasergun,
    shotgun
}

//人物获得枪械类需要为ObjcetPool赋值,需要写个计时器
public abstract class Firearms : ScriptableObject {
    [Header("子弹的预设")]
    public GameObject bullet;//需要实例化的对象（子弹）
    [Header("开火间隔"),Range(0.05f,1f)]
    public float coolTime;//时间间隔（多久生成一次）
    [Header("武器类型")]
    public FirearmsType firearmsType;//枪械类型
    //[Header("物体上对象池组件"),HideInInspector]
    //public ObjectPool[] objectPools;//多个对象池组件,需要对象池组件并获取
    protected bool isFire = true;
    protected float cTime;
    protected GameObject bulTemp;
    /// <summary>
    /// 开火间隔计时器，在Update中调用
    /// </summary>
    public void Timer()
    {
        cTime -= Time.deltaTime;
    }
    /// <summary>
    /// 实例化对象的方法（开火方法）,有生成冷却
    /// </summary>
    /// <param name="SendTrans">实例化子弹的位置</param>
    /// <param name="bulletRot">实例化子弹的方向（旋转）</param>
    /// <param name="objectPool">对应对象池的组件</param>
    public abstract void InstantiateBullet(Transform SendTrans,Quaternion bulletRot, ObjectPool objectPool);
}